﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="RolesList.aspx.cs" Inherits="PurviewManage_RolesList" Title="角色列表" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
   
    <div class="title">
        <asp:Label ID="lblPageType" runat="server" Text="角色列表"></asp:Label></div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        
          <table class="add_table" cellspacing="1" cellpadding="3">
                <tr>
                    <td align="right">
                        <asp:Label ID="lblRoleName" runat="server" Text="角色名："></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtRoleName" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblRoleCode" runat="server" Text="角色编码："></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtRoleCode" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>                   
                    <td colspan="4" align="center">
                        <asp:Button ID="btnSearch" runat="server" CssClass="btn" Text="搜索" OnClick="btnSearch_Click" />
                    </td>
                </tr>
            </table>
         <div class="list_title">
                    <div class="autoleft">
                        <asp:Label ID="lblSelectOut" runat="server" Text="检索出"></asp:Label><asp:Label ID="lblTotal" runat="server"></asp:Label>
                        <asp:Label ID="lblSelectOut2" runat="server" Text="个权限"></asp:Label>&nbsp;<a href="RoleAdd.aspx"><asp:Label
                    ID="lblRoleAdd" runat="server" Text="添加角色"></asp:Label></a></div>
                    <div class="autoright">                       
                        每页显示：
                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
                            <asp:ListItem Selected="True" Text="10" Value="10"></asp:ListItem>
                            <asp:ListItem Text="15" Value="15"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>
    <asp:GridView ID="grvList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        OnPageIndexChanging="grvList_PageIndexChanging" AllowSorting="true" Width="100%" 
                OnRowCommand="grvList_RowCommand" onsorting="grvList_Sorting" 
                onrowdatabound="grvList_RowDataBound">
        <PagerTemplate>
            <table style="width: 100%">
                <tr>
                    <td>
                        页次:&nbsp;<asp:Label ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1      %>'></asp:Label>/<asp:Label
                            ID="Label2" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页&nbsp;
                        总计:&nbsp;<asp:Label ID="Label3" runat="server" Text="<%# ((System.Data.DataView)grvList.DataSource).Count %>"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                            Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">首页</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                            Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">前页</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                            Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">后页</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                            Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">尾页</asp:LinkButton>&nbsp;
                        <asp:Label ID="lblTurnOn" runat="server" Text="转第"></asp:Label><asp:TextBox ID="txtPages" runat="server" Width="35px"></asp:TextBox>
                                    <asp:Label ID="lblPages2" runat="server" Text="页"></asp:Label>
                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" onclick="lbtnGo_Click"></asp:LinkButton>
                        
                    </td>
                </tr>
            </table>
        </PagerTemplate>
        <Columns>
            <asp:BoundField DataField="RoleName" ItemStyle-Width="10%" HeaderText="角色名称" SortExpression="RoleName" />
            <asp:TemplateField HeaderText="角色权限" SortExpression="RolePurview">
                    <ItemTemplate>
                        <div style="text-align: left">
                            <asp:Label ID="lblGroup" runat="server" Text='<%# GetOperationName(Eval("RolePurview"))%>'></asp:Label>
                        </div>
                    </ItemTemplate>
                    <ItemStyle Width="60%" />
                </asp:TemplateField>
            <asp:BoundField DataField="Description" ItemStyle-Width="20%" HeaderText="角色描述" SortExpression="Description" />
            <asp:TemplateField  HeaderText="操作">
                <ItemTemplate>
                <a href="RoleAdd.aspx?RoleID=<%# Eval("RoleID")%>"><asp:Label ID="lblEdit" runat="server" Text="修改"></asp:Label></a>             
                   
                    <asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("RoleID") %>' CommandName="DelRole"
                        OnClientClick="javascript:return confirm('确定要删除该角色？');" runat="server">删除</asp:LinkButton>
                </ItemTemplate>
                <ItemStyle Width="10%" />
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Center" />
        <RowStyle HorizontalAlign="Center" />
    </asp:GridView>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

